#!/bin/bash
#
read -p "服务名：" service

if ps -elf | grep "$service" | grep -v "grep" &>/dev/null;then
	service_id=$(pgrep $service)
	service_port=$(netstat -tunlp | grep "$service" | awk '{print $4}' | awk -F: '{print $NF}')
	echo "服务名称：$service 端口：$service_port PID：$service_id"
else
	echo "服务${service}没有启动！"  
fi
